package com.burningtower.service.impl;

import com.burningtower.entity.Organization;
import com.burningtower.mapper.OrganizationMapper;
import com.burningtower.service.IOrganizationService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.burningtower.vo.TreeVo;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 组织机构 服务实现类
 * </p>
 *
 * @author zhe
 * @since 2017-11-17
 */
@Service
public class OrganizationServiceImpl extends ServiceImpl<OrganizationMapper, Organization> implements IOrganizationService {

    @Override
    public TreeVo toVo(Organization organization) {
        TreeVo vo=new TreeVo();
        BeanUtils.copyProperties(organization,vo);
        vo.setIconCls(organization.getIcon());
        vo.setText(organization.getName());
        vo.setState("open");
        vo.setChecked(false);
        return vo;
    }

    @Override
    public String selectNameById(Long id) {
        return baseMapper.selectNameById(id);
    }
}
